package org.creativor.rayson.common;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import java.io.ByteArrayOutputStream;
import java.io.DataInput;
import java.io.DataInputStream;
import java.io.DataOutput;
import java.io.DataOutputStream;
import java.io.PipedInputStream;
import java.lang.reflect.Method;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;

/**
 * The class <code>InvocationTest</code> contains tests for the class
 * <code>{@link Invocation}</code>.
 * <p>
 * Copyright Creativor Studio (c) 2011
 * 
 * @generatedBy CodePro at 11-5-7 上午2:56
 * @author Nick Zhang
 * @version $Revision: 1.0 $
 */
public class InvocationTest
{
	/**
	 * Launch the test.
	 * 
	 * @param args
	 *            the command line arguments
	 * 
	 * @generatedBy CodePro at 11-5-7 上午2:56
	 */
	public static void main(String[] args)
	{
		new org.junit.runner.JUnitCore().run(InvocationTest.class);
	}
	
	/**
	 * Perform pre-test initialization.
	 * 
	 * @throws Exception
	 *             if the initialization fails for some reason
	 * 
	 * @generatedBy CodePro at 11-5-7 上午2:56
	 */
	@Before
	public void setUp() throws Exception
	{
		// TODO: add additional set up code here
	}
	
	/**
	 * Perform post-test clean-up.
	 * 
	 * @throws Exception
	 *             if the clean-up fails for some reason
	 * 
	 * @generatedBy CodePro at 11-5-7 上午2:56
	 */
	@After
	public void tearDown() throws Exception
	{
		// TODO: add additional tear down code here
	}
	
	/**
	 * Run the int getHashCode() method test.
	 * 
	 * @throws Exception
	 * 
	 * @generatedBy CodePro at 11-5-7 上午2:56
	 */
	@Test
	public void testGetHashCode_1() throws Exception
	{
		Invocation fixture = new Invocation();
		
		int result = fixture.getHashCode();
		
		// TODO: add additional test code here
		assertEquals(0, result);
	}
	
	/**
	 * Run the int getHashCode(Method) method test.
	 * 
	 * @throws Exception
	 * 
	 * @generatedBy CodePro at 11-5-7 上午2:56
	 */
	@Test
	public void testGetHashCode_2() throws Exception
	{
		Method method = Object.class.getMethods()[0];
		
		int result = Invocation.getHashCode(method);
		
		// TODO: add additional test code here
		assertEquals(-1708668998, result);
	}
	
	/**
	 * Run the int getHashCode(Method) method test.
	 * 
	 * @throws Exception
	 * 
	 * @generatedBy CodePro at 11-5-7 上午2:56
	 */
	@Test
	public void testGetHashCode_3() throws Exception
	{
		Method method = Object.class.getMethods()[0];
		
		int result = Invocation.getHashCode(method);
		
		// TODO: add additional test code here
		assertEquals(-1708668998, result);
	}
	
	/**
	 * Run the int getHashCode(Method) method test.
	 * 
	 * @throws Exception
	 * 
	 * @generatedBy CodePro at 11-5-7 上午2:56
	 */
	@Test(expected = java.lang.IllegalArgumentException.class)
	public void testGetHashCode_4() throws Exception
	{
		Method method = null;
		
		int result = Invocation.getHashCode(method);
		
		// TODO: add additional test code here
		assertEquals(0, result);
	}
	
	/**
	 * Run the Invocation() constructor test.
	 * 
	 * @throws Exception
	 * 
	 * @generatedBy CodePro at 11-5-7 上午2:56
	 */
	@Test
	public void testInvocation_1() throws Exception
	{
		
		Invocation result = new Invocation();
		
		// TODO: add additional test code here
		assertNotNull(result);
		assertEquals(0, result.getHashCode());
	}
	
	/**
	 * Run the Invocation(Method,Object[]) constructor test.
	 * 
	 * @throws Exception
	 * 
	 * @generatedBy CodePro at 11-5-7 上午2:56
	 */
	@Test
	public void testInvocation_2() throws Exception
	{
		Method method = Object.class.getMethods()[0];
		Object[] parameters = new Object[] {};
		// TODO: add version info here.
		
		Invocation result = new Invocation(-1, method, parameters);
		
		// TODO: add additional test code here
		assertNotNull(result);
		assertEquals("{hash code: -1708668998, parameters: ]}", result.toString());
		assertEquals(-1708668998, result.getHashCode());
	}
	
	/**
	 * Run the Invocation(Method,Object[]) constructor test.
	 * 
	 * @throws Exception
	 * 
	 * @generatedBy CodePro at 11-5-7 上午2:56
	 */
	@Test
	public void testInvocation_3() throws Exception
	{
		Method method = Object.class.getMethods()[0];
		Object[] parameters = new Object[] {};
		// TODO: add version info here.
		Invocation result = new Invocation(-1, method, parameters);
		
		// TODO: add additional test code here
		assertNotNull(result);
		assertEquals("{hash code: -1708668998, parameters: ]}", result.toString());
		assertEquals(-1708668998, result.getHashCode());
	}
	
	/**
	 * Run the Invocation(Method,Object[]) constructor test.
	 * 
	 * @throws Exception
	 * 
	 * @generatedBy CodePro at 11-5-7 上午2:56
	 */
	@Test
	public void testInvocation_4() throws Exception
	{
		Method method = Object.class.getMethods()[0];
		Object[] parameters = new Object[] {};
		// TODO: add version info here.
		Invocation result = new Invocation(-1, method, parameters);
		
		// TODO: add additional test code here
		assertNotNull(result);
		assertEquals("{hash code: -1708668998, parameters: ]}", result.toString());
		assertEquals(-1708668998, result.getHashCode());
	}
	
	/**
	 * Run the Invocation(Method,Object[]) constructor test.
	 * 
	 * @throws Exception
	 * 
	 * @generatedBy CodePro at 11-5-7 上午2:56
	 */
	@Test
	public void testInvocation_5() throws Exception
	{
		Method method = Object.class.getMethods()[0];
		Object[] parameters = new Object[] {};
		// TODO: add version info here.
		Invocation result = new Invocation(-1, method, parameters);
		
		// TODO: add additional test code here
		assertNotNull(result);
		assertEquals("{hash code: -1708668998, parameters: ]}", result.toString());
		assertEquals(-1708668998, result.getHashCode());
	}
	
	/**
	 * Run the Invocation(Method,Object[]) constructor test.
	 * 
	 * @throws Exception
	 * 
	 * @generatedBy CodePro at 11-5-7 上午2:56
	 */
	@Test
	public void testInvocation_6() throws Exception
	{
		Method method = Object.class.getMethods()[0];
		Object[] parameters = new Object[] {};
		// TODO: add version info here.
		Invocation result = new Invocation(-1, method, parameters);
		
		// TODO: add additional test code here
		assertNotNull(result);
		assertEquals("{hash code: -1708668998, parameters: ]}", result.toString());
		assertEquals(-1708668998, result.getHashCode());
	}
	
	/**
	 * Run the Object invoke(RpcRequest,RpcService,Method) method test.
	 * 
	 * @throws Exception
	 * 
	 * @generatedBy CodePro at 11-5-7 上午2:56
	 */
	@Test(expected = org.creativor.rayson.exception.CallInvokeException.class)
	public void testInvoke_1() throws Exception
	{
		
		// TODO: add additional test code here
	}
	
	/**
	 * Run the void read(DataInput) method test.
	 * 
	 * @throws Exception
	 * 
	 * @generatedBy CodePro at 11-5-7 上午2:56
	 */
	@Test(expected = java.io.IOException.class)
	public void testRead_1() throws Exception
	{
		Invocation fixture = new Invocation();
		DataInput in = new DataInputStream(new PipedInputStream());
		
		fixture.read(in);
		
		// TODO: add additional test code here
	}
	
	/**
	 * Run the void read(DataInput) method test.
	 * 
	 * @throws Exception
	 * 
	 * @generatedBy CodePro at 11-5-7 上午2:56
	 */
	@Test(expected = java.io.IOException.class)
	public void testRead_2() throws Exception
	{
		Invocation fixture = new Invocation();
		DataInput in = new DataInputStream(new PipedInputStream());
		
		fixture.read(in);
		
		// TODO: add additional test code here
	}
	
	/**
	 * Run the void read(DataInput) method test.
	 * 
	 * @throws Exception
	 * 
	 * @generatedBy CodePro at 11-5-7 上午2:56
	 */
	@Test(expected = java.io.IOException.class)
	public void testRead_3() throws Exception
	{
		Invocation fixture = new Invocation();
		DataInput in = new DataInputStream(new PipedInputStream());
		
		fixture.read(in);
		
		// TODO: add additional test code here
	}
	
	/**
	 * Run the void read(DataInput) method test.
	 * 
	 * @throws Exception
	 * 
	 * @generatedBy CodePro at 11-5-7 上午2:56
	 */
	@Test(expected = java.io.IOException.class)
	public void testRead_4() throws Exception
	{
		Invocation fixture = new Invocation();
		DataInput in = new DataInputStream(new PipedInputStream());
		
		fixture.read(in);
		
		// TODO: add additional test code here
	}
	
	/**
	 * Run the void read(DataInput) method test.
	 * 
	 * @throws Exception
	 * 
	 * @generatedBy CodePro at 11-5-7 上午2:56
	 */
	@Test(expected = java.io.IOException.class)
	public void testRead_5() throws Exception
	{
		Invocation fixture = new Invocation();
		DataInput in = new DataInputStream(new PipedInputStream());
		
		fixture.read(in);
		
		// TODO: add additional test code here
	}
	
	/**
	 * Run the String toString() method test.
	 * 
	 * @throws Exception
	 * 
	 * @generatedBy CodePro at 11-5-7 上午2:56
	 */
	@Test
	public void testToString_1() throws Exception
	{
		Invocation fixture = new Invocation();
		
		String result = fixture.toString();
		
		// TODO: add additional test code here
		// An unexpected exception was thrown in user code while executing this
		// test:
		// java.lang.NullPointerException
		// at
		// org.creativor.rayson.common.Invocation.toString(Invocation.java:147)
		assertNotNull(result);
	}
	
	/**
	 * Run the String toString() method test.
	 * 
	 * @throws Exception
	 * 
	 * @generatedBy CodePro at 11-5-7 上午2:56
	 */
	@Test
	public void testToString_2() throws Exception
	{
		Invocation fixture = new Invocation();
		
		String result = fixture.toString();
		
		// TODO: add additional test code here
		// An unexpected exception was thrown in user code while executing this
		// test:
		// java.lang.NullPointerException
		// at
		// org.creativor.rayson.common.Invocation.toString(Invocation.java:147)
		assertNotNull(result);
	}
	
	/**
	 * Run the String toString() method test.
	 * 
	 * @throws Exception
	 * 
	 * @generatedBy CodePro at 11-5-7 上午2:56
	 */
	@Test
	public void testToString_3() throws Exception
	{
		Invocation fixture = new Invocation();
		
		String result = fixture.toString();
		
		// TODO: add additional test code here
		// An unexpected exception was thrown in user code while executing this
		// test:
		// java.lang.NullPointerException
		// at
		// org.creativor.rayson.common.Invocation.toString(Invocation.java:147)
		assertNotNull(result);
	}
	
	/**
	 * Run the void write(DataOutput) method test.
	 * 
	 * @throws Exception
	 * 
	 * @generatedBy CodePro at 11-5-7 上午2:56
	 */
	@Test
	public void testWrite_1() throws Exception
	{
		Invocation fixture = new Invocation();
		DataOutput out = new DataOutputStream(new ByteArrayOutputStream());
		
		fixture.write(out);
		
		// TODO: add additional test code here
		// An unexpected exception was thrown in user code while executing this
		// test:
		// java.lang.NullPointerException
		// at org.creativor.rayson.common.Invocation.write(Invocation.java:161)
	}
	
	/**
	 * Run the void write(DataOutput) method test.
	 * 
	 * @throws Exception
	 * 
	 * @generatedBy CodePro at 11-5-7 上午2:56
	 */
	@Test
	public void testWrite_2() throws Exception
	{
		Invocation fixture = new Invocation();
		DataOutput out = new DataOutputStream(new ByteArrayOutputStream());
		
		fixture.write(out);
		
		// TODO: add additional test code here
		// An unexpected exception was thrown in user code while executing this
		// test:
		// java.lang.NullPointerException
		// at org.creativor.rayson.common.Invocation.write(Invocation.java:161)
	}
	
	/**
	 * Run the void write(DataOutput) method test.
	 * 
	 * @throws Exception
	 * 
	 * @generatedBy CodePro at 11-5-7 上午2:56
	 */
	@Test
	public void testWrite_3() throws Exception
	{
		Invocation fixture = new Invocation();
		DataOutput out = new DataOutputStream(new ByteArrayOutputStream());
		
		fixture.write(out);
		
		// TODO: add additional test code here
		// An unexpected exception was thrown in user code while executing this
		// test:
		// java.lang.NullPointerException
		// at org.creativor.rayson.common.Invocation.write(Invocation.java:161)
	}
	
	/**
	 * Run the void write(DataOutput) method test.
	 * 
	 * @throws Exception
	 * 
	 * @generatedBy CodePro at 11-5-7 上午2:56
	 */
	@Test
	public void testWrite_4() throws Exception
	{
		Invocation fixture = new Invocation();
		DataOutput out = new DataOutputStream(new ByteArrayOutputStream());
		
		fixture.write(out);
		
		// TODO: add additional test code here
		// An unexpected exception was thrown in user code while executing this
		// test:
		// java.lang.NullPointerException
		// at org.creativor.rayson.common.Invocation.write(Invocation.java:161)
	}
	
	/**
	 * Run the void write(DataOutput) method test.
	 * 
	 * @throws Exception
	 * 
	 * @generatedBy CodePro at 11-5-7 上午2:56
	 */
	@Test
	public void testWrite_5() throws Exception
	{
		Invocation fixture = new Invocation();
		DataOutput out = new DataOutputStream(new ByteArrayOutputStream());
		
		fixture.write(out);
		
		// TODO: add additional test code here
		// An unexpected exception was thrown in user code while executing this
		// test:
		// java.lang.NullPointerException
		// at org.creativor.rayson.common.Invocation.write(Invocation.java:161)
	}
}
